package com.woniuxy.house.utils;

public class RedisUtil {
    public static String generate(Object target, String methodName, Object... params) {
        StringBuilder sBuilder = new StringBuilder();
        sBuilder.append(target.getClass().getName());
        sBuilder.append(".");
        sBuilder.append(methodName);    //生成key
        if(params != null){
            for(Object object:params){
                sBuilder.append(".");
                sBuilder.append(object.toString());
            }
        }
        return sBuilder.toString();
    }

    public static String findKey(String className,String methodName, Object... params){
        StringBuilder sBuilder = new StringBuilder();
        sBuilder.append("find:" + className + methodName);
        if(params != null){
            for(Object object:params){
                sBuilder.append(":");
                sBuilder.append(object.toString());
            }
        }
        return sBuilder.toString();
    }

    public static String delKey(String className){
        StringBuilder sBuilder = new StringBuilder();
        sBuilder.append("find:" + className);
        return sBuilder.toString();
    }
}
